package com.example.controller;

import com.example.data.request.ReqClassesList;
import com.example.entity.Classes;
import com.example.service.impl.ClassesServiceImpl;
import com.example.utils.R;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * Author:yanghua
 * Date:2023/10/7 10:04
 */
@Slf4j
@RestController
@RequestMapping("classes")
public class ClassesController {
    @Resource
    private ClassesServiceImpl classesService;
    @PostMapping("addClasses")
    private R add(@RequestBody Classes classes) {
        return classesService.addOneClass(classes);
    }
    @PostMapping("getClassesList")
    private R getClassesList(@RequestBody ReqClassesList reqClassesList) {
        return classesService.getClassesList(reqClassesList);
    }
    @DeleteMapping("deleteClassById/{id}")
    private R delete(@PathVariable Long id) {
        return classesService.deleteClassById(id);
    }
    @PutMapping("updateClassesInfo")
    private R update(@RequestBody Classes classes) {
        return classesService.updateInfo(classes);
    }
}
